import os

from app import create_app
from app.utils.sql_loader import SqlLoader
from dotenv import load_dotenv


load_dotenv()

flask_env = os.environ.get('ENV')

if flask_env not in ['production', 'testing', 'development']:
    raise Exception('Env does not support')

# Preload sqls
SqlLoader.preload_all_sqls()


app = create_app(config_name=flask_env)


if __name__ == '__main__':
    app.run('0.0.0.0', port=5001, debug=False)
